﻿<Application xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
             x:Class="BingVis.SilverlightClient.App"
             xmlns:local="clr-namespace:BingVis.SilverlightClient"
             xmlns:cal="clr-namespace:Microsoft.Practices.Composite.Presentation.Commands;assembly=Microsoft.Practices.Composite.Presentation"
             xmlns:chartingToolkit="clr-namespace:System.Windows.Controls.DataVisualization.Charting;assembly=System.Windows.Controls.DataVisualization.Toolkit" 
             xmlns:visualizationToolkit="clr-namespace:System.Windows.Controls.DataVisualization;assembly=System.Windows.Controls.DataVisualization.Toolkit" 
             xmlns:System_Windows_Controls_DataVisualization_Charting_Primitives="clr-namespace:System.Windows.Controls.DataVisualization.Charting.Primitives;assembly=System.Windows.Controls.DataVisualization.Toolkit"
             >
    <Application.Resources>

        <ResourceDictionary>

            <Style x:Key="DollarStyle" TargetType="Path">
            <Setter Property="Fill">
                <Setter.Value>
                    <RadialGradientBrush RadiusX="0.410974" RadiusY="0.385673" Center="0.5,0.532601" GradientOrigin="0.5,0.532601">
                        <RadialGradientBrush.GradientStops>
                            <GradientStop Color="#FF35710F" Offset="0"/>
                            <GradientStop Color="#FF5AB123" Offset="0.767442"/>
                            <GradientStop Color="#FF80F138" Offset="1"/>
                        </RadialGradientBrush.GradientStops>
                        <RadialGradientBrush.RelativeTransform>
                            <TransformGroup/>
                        </RadialGradientBrush.RelativeTransform>
                    </RadialGradientBrush>
                </Setter.Value>
            </Setter>
        </Style>

            <local:StopNameToColorConverter x:Key="StopNameToColorCvt"/>
            <local:StopNameToHasStopFareConverter x:Key="StopNameToHasStopFareCvt"/>

            <Color x:Key="BlackCol">Black</Color>
        <Color x:Key="LightGrayCol">LightGray</Color>
        <Color x:Key="DarkGrayCol">DarkGray</Color>

        <SolidColorBrush
        x:Key="BrightTextBrush"
        Color="White" />
        <SolidColorBrush
        x:Key="NormalTextBrush"
        Color="WhiteSmoke" />

        <SolidColorBrush
        x:Key="BlackBrush"        
        Color="Black" />
        <SolidColorBrush
        x:Key="LightGrayBrush"
        Color="LightGray" />
        <SolidColorBrush
        x:Key="DarkGrayBrush"
        Color="DarkGray" />
        <SolidColorBrush
        x:Key="DarkSlateGrayBrush"
        Color="#282828" />

        <Style TargetType="TextBlock">
            <Setter Property="Foreground" Value="White" />
        </Style>

        <Style x:Key="LayoutRootStyle" TargetType="Grid">
            <Setter Property="Background" Value="{StaticResource DarkSlateGrayBrush}" />
        </Style>

        <Style x:Key="RoundedPaneBase" TargetType="Border">
            <Setter Property="Background" Value="{StaticResource BlackBrush}" />
            <Setter Property="BorderBrush" Value="{StaticResource DarkGrayBrush}" />
            <Setter Property="BorderThickness" Value="2" />
            <Setter Property="CornerRadius" Value="5" />
            <Setter Property="Padding" Value="7" />
            <Setter Property="HorizontalAlignment" Value="Stretch" />
            <Setter Property="VerticalAlignment" Value="Stretch" />
            <Setter Property="Margin" Value="4" />
        </Style>

        <Style x:Key="LeftPaneStyle" BasedOn="{StaticResource RoundedPaneBase}" TargetType="Border">

        </Style>
        <Style x:Key="MapPaneStyle" BasedOn="{StaticResource RoundedPaneBase}" TargetType="Border">

        </Style>
        <Style x:Key="BottomPaneStyle" BasedOn="{StaticResource RoundedPaneBase}" TargetType="Border">

        </Style>

        <Style
        x:Key="StopsListStyle"
        TargetType="ItemsControl">
            <Setter
            Property="ItemTemplate">
                <Setter.Value>
                    <DataTemplate>
                        <StackPanel
                        Orientation="Vertical"
                        Margin="0 0 0 2"                        
                        
                        >
                            <StackPanel
                            Cursor="Hand"                            
                            Orientation="Horizontal" Margin="0 0 0 0">
                                <Rectangle Height="12" Width="12" 
                                    Fill="{Binding Stop.Name, Converter={StaticResource StopNameToColorCvt}}" />
                                    <Button
                                        Margin="4 2 4 2"
                                        Content="{Binding Stop.Name}"
                                        cal:Click.Command="{Binding Selected}">
                                    <Button.Template>
                                        <ControlTemplate>
                                            <TextBlock FontSize="12" Foreground="White" Text="{Binding Stop.Name}"></TextBlock>
                                        </ControlTemplate>
                                    </Button.Template>
                                </Button>
                                <Path                                
                                    Width="10" Height="10.5" Stretch="Fill" Margin="0 0 0 0"
                                    Style="{StaticResource DollarStyle}" 
                                    Data="F1 M 7.71702,18.4045L 7.71702,16.4784C 6.12845,16.3625 4.83654,16.1558 3.84128,15.8582C 2.84603,15.5606 1.98667,15.0802 1.2632,14.417C 0.539732,13.7538 0.118665,12.9429 0,11.9843L 3.30729,11.7703C 3.54845,12.6107 3.97335,13.2282 4.58198,13.6228C 5.45474,14.1779 6.49975,14.4877 7.71702,14.5524L 7.71702,9.04843C 6.36578,8.82773 5.04133,8.5045 3.74367,8.07871C 2.77905,7.76439 2.03644,7.32858 1.51584,6.77127C 0.995251,6.21397 0.734954,5.58198 0.734954,4.87532C 0.734954,3.61803 1.51393,2.59928 3.07188,1.81905C 4.11689,1.29518 5.66527,0.974172 7.71702,0.856021L 7.71702,-5.96046e-007L 9.55441,-5.96046e-007L 9.55441,0.856021C 11.4224,0.963025 12.9038,1.29072 13.9986,1.83911C 15.4034,2.53463 16.2494,3.49097 16.5365,4.70812L 13.2292,4.92213C 13.0378,4.28457 12.6406,3.79581 12.0377,3.45586C 11.4349,3.1159 10.6071,2.89131 9.55441,2.78207L 9.55441,7.37985C 11.1927,7.64959 12.2779,7.84799 12.81,7.97506C 13.8206,8.22473 14.6455,8.52846 15.2848,8.88625C 15.924,9.24404 16.4149,9.66871 16.7575,10.1603C 17.1001,10.6518 17.2714,11.184 17.2714,11.7569C 17.2714,13.0164 16.5547,14.0675 15.1211,14.9102C 13.6876,15.7528 11.832,16.2042 9.55441,16.2644L 9.55441,18.4045L 7.71702,18.4045 Z M 7.71702,2.56807C 6.58014,2.66392 5.68346,2.91583 5.02697,3.32378C 4.37049,3.73172 4.04225,4.21547 4.04225,4.775C 4.04225,5.32562 4.2901,5.78707 4.78582,6.15935C 5.28153,6.53163 6.2586,6.83704 7.71702,7.07556L 7.71702,2.56807 Z M 9.55441,14.5524C 10.8291,14.4699 11.8827,14.1807 12.7153,13.6847C 13.5478,13.1887 13.9641,12.5739 13.9641,11.8405C 13.9641,11.2186 13.656,10.7181 13.0397,10.3391C 12.4234,9.96018 11.2616,9.63026 9.55441,9.34937L 9.55441,14.5524 Z"
                                    Visibility="{Binding Stop.Name, Converter={StaticResource StopNameToHasStopFareCvt}}" />
                            </StackPanel>
                        </StackPanel>
                    </DataTemplate>
                </Setter.Value>
            </Setter>
        </Style>
        
        <!-- Chart Styles -->
            <Style x:Key="AreaSeriesStyle1" TargetType="chartingToolkit:AreaSeries">
                <Setter Property="IsTabStop" Value="False"/>
                <Setter Property="PathStyle">
                    <Setter.Value>
                        <Style TargetType="Path">
                            <Setter Property="StrokeThickness" Value="2"/>
                            <Setter Property="Opacity" Value="0.6"/>
                            <Setter Property="Margin" Value="0 0 0 0" />
                        </Style>
                    </Setter.Value>
                </Setter>
                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="chartingToolkit:AreaSeries">
                            <Canvas x:Name="PlotArea">
                                <Path Fill="{TemplateBinding Background}" StrokeThickness="3" Style="{TemplateBinding PathStyle}" Data="{TemplateBinding Geometry}"/>
                            </Canvas>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Style>


            <ControlTemplate x:Key="DataPointStyle" TargetType="chartingToolkit:AreaDataPoint">
                <Grid x:Name="Root" Opacity="0">
                   
                    <VisualStateManager.VisualStateGroups>
                        <VisualStateGroup x:Name="CommonStates">
                            <VisualStateGroup.Transitions>
                                <VisualTransition GeneratedDuration="00:00:00.1000000"/>
                            </VisualStateGroup.Transitions>
                            <VisualState x:Name="Normal"/>
                            <VisualState x:Name="MouseOver">
                                <Storyboard>
                                    <ColorAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="MouseOverHighlight" Storyboard.TargetProperty="(Shape.Fill).(SolidColorBrush.Color)">
                                        <SplineColorKeyFrame KeyTime="00:00:00" Value="#FFFFDF00"/>
                                    </ColorAnimationUsingKeyFrames>
                                    <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="MouseOverHighlight" Storyboard.TargetProperty="(UIElement.Opacity)">
                                        <SplineDoubleKeyFrame KeyTime="00:00:00" Value="0.24"/>
                                    </DoubleAnimationUsingKeyFrames>
                                </Storyboard>
                            </VisualState>
                        </VisualStateGroup>
                        <VisualStateGroup x:Name="SelectionStates">
                            <VisualStateGroup.Transitions>
                                <VisualTransition GeneratedDuration="00:00:00.1000000"/>
                            </VisualStateGroup.Transitions>
                            <VisualState x:Name="Unselected"/>
                            <VisualState x:Name="Selected">
                                <Storyboard>
                                    <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="SelectionHighlight" Storyboard.TargetProperty="(UIElement.Opacity)">
                                        <SplineDoubleKeyFrame KeyTime="00:00:00" Value="0.18"/>
                                    </DoubleAnimationUsingKeyFrames>
                                </Storyboard>
                            </VisualState>
                        </VisualStateGroup>
                        <VisualStateGroup x:Name="RevealStates">
                            <VisualStateGroup.Transitions>
                                <VisualTransition GeneratedDuration="00:00:00.5000000"/>
                            </VisualStateGroup.Transitions>
                            <VisualState x:Name="Shown">
                                <Storyboard>
                                    <DoubleAnimation Duration="00:00:00" Storyboard.TargetName="Root" Storyboard.TargetProperty="Opacity" To="1"/>
                                </Storyboard>
                            </VisualState>
                            <VisualState x:Name="Hidden">
                                <Storyboard>
                                    <DoubleAnimation Duration="00:00:00" Storyboard.TargetName="Root" Storyboard.TargetProperty="Opacity" To="0"/>
                                </Storyboard>
                            </VisualState>
                        </VisualStateGroup>
                    </VisualStateManager.VisualStateGroups>
                    <Ellipse x:Name="MainPoint" Fill="{TemplateBinding Background}" Stroke="{TemplateBinding BorderBrush}" Margin="1"/>
                    <Ellipse x:Name="OtherPoint" RenderTransformOrigin="0.661,0.321" Margin="1">
                        <Ellipse.Fill>
                            <RadialGradientBrush GradientOrigin="0.681,0.308">
                                <GradientStop Color="Transparent"/>
                                <GradientStop Color="Blue" Offset="1"/>
                                <!--<GradientStop Color="#FF3D3A3A" Offset="1"/>-->
                            </RadialGradientBrush>
                        </Ellipse.Fill>
                    </Ellipse>
                    <Ellipse x:Name="SelectionHighlight" Fill="Red" Opacity="0"/>
                    <Ellipse x:Name="MouseOverHighlight" Fill="White" Opacity="0"/>
                    <Ellipse x:Name="ChangingHighlight">
                        <Ellipse.Fill>
                            <RadialGradientBrush GradientOrigin="0.681,0.308">
                                <GradientStop Color="Transparent"/>
                                <GradientStop Color="Blue" Offset="1"/>
                                <!--<GradientStop Color="#FF3D3A3A" Offset="1"/>-->
                            </RadialGradientBrush>
                        </Ellipse.Fill>
                    </Ellipse>
                </Grid>
            </ControlTemplate>

            <Style x:Key="ChartStyle1" TargetType="chartingToolkit:Chart">
                <Setter Property="BorderBrush" Value="Black"/>
                <Setter Property="BorderThickness" Value="1"/>
                <Setter Property="IsTabStop" Value="False"/>
                
                <Setter Property="TitleStyle">
                    <Setter.Value>
                        <Style TargetType="visualizationToolkit:Title">
                            <Setter Property="FontSize" Value="16"/>
                            <Setter Property="HorizontalAlignment" Value="Center"/>
                            <Setter Property="Visibility" Value="Collapsed" />
                        </Style>
                    </Setter.Value>
                </Setter>
                <Setter Property="LegendStyle">
                    <Setter.Value>
                        <Style TargetType="visualizationToolkit:Legend">
                            <Setter Property="Margin" Value="15,0"/>
                            <Setter Property="VerticalAlignment" Value="Center"/>
                            <Setter Property="BorderBrush" Value="#FFDBDBDB"/>
                            <Setter Property="Visibility" Value="Collapsed" />
                            <Setter Property="Background">
                                <Setter.Value>
                                    <LinearGradientBrush EndPoint="0.442,0.005" StartPoint="0.558,0.995">
                                        <GradientStop Color="#FFDBDBDB"/>
                                        <GradientStop Color="White" Offset="1"/>
                                    </LinearGradientBrush>
                                </Setter.Value>
                            </Setter>
                        </Style>
                    </Setter.Value>
                </Setter>
                <Setter Property="ChartAreaStyle">
                    <Setter.Value>
                        <Style TargetType="Panel">
                            <Setter Property="MinWidth" Value="100"/>
                            <Setter Property="MinHeight" Value="75"/>
                        </Style>
                    </Setter.Value>
                </Setter>
                <Setter Property="PlotAreaStyle">
                    <Setter.Value>
                        <Style TargetType="Grid">
                            <Setter Property="Background">
                                <Setter.Value>
                                    <LinearGradientBrush EndPoint="0.457,0.296" StartPoint="0.459,1.296">
                                        <GradientStop Color="#FFCBCBCB"/>
                                        <GradientStop Color="White" Offset="1"/>
                                    </LinearGradientBrush>
                                </Setter.Value>
                            </Setter>
                        </Style>
                    </Setter.Value>
                </Setter>
                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="chartingToolkit:Chart">
                            <Border Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Padding="0 0 12 0">
                                <Grid Margin="5">
                                    <Grid.RowDefinitions>
                                        <RowDefinition Height="Auto"/>
                                        <RowDefinition Height="*"/>
                                    </Grid.RowDefinitions>

                                    <Grid Margin="0" Grid.Row="1">
                                        <Grid.ColumnDefinitions>
                                            <ColumnDefinition Width="*"/>
                                            <ColumnDefinition Width="Auto"/>
                                        </Grid.ColumnDefinitions>
                                        <System_Windows_Controls_DataVisualization_Charting_Primitives:EdgePanel x:Name="ChartArea" Style="{TemplateBinding ChartAreaStyle}">
                                            <Grid Style="{TemplateBinding PlotAreaStyle}" Background="{x:Null}"/>
                                            <Border BorderBrush="#FF919191" BorderThickness="1" Padding="0" Background="LightGray" Opacity=".2" CornerRadius="5"/>
                                        </System_Windows_Controls_DataVisualization_Charting_Primitives:EdgePanel>
                                    </Grid>
                                </Grid>
                            </Border>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Style>
        </ResourceDictionary>
    </Application.Resources>
</Application>
